
function check(){
    //1、获取元素节点值
    var ctx = document.getElementById("txt1").value;
    //2、正则表达式校验
    //var reg = /^a$/
    //var reg = /^[abcdefghijklmnopqrstuvwxyz]$/
    //var reg = /^[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]$/
    //var reg = /^[a-z]$/
    //var reg = /^[0-9]$/
    //var reg = /^[a-zA-Z]$/
    //var reg = /^[a-zA-Z][a-zA-Z]$/
    //var reg = /^[a-z]{3,5}$/;
    //var reg = /^[a-z]{3,}$/;
    //var reg = /^[a-z]{3}$/;
    //var reg = /^[a-z]+$/;
    //var reg = /^\d+$/;
    //var reg = /^\w$/;
    //var reg = /^[^0-8]$/;
    //var reg = /[a-z]/i
    var reg = /a/g
    var arr1 = [];
    console.log(arr1 = reg.exec(ctx))
    console.log(reg.exec(ctx))
    //if(!reg.test(ctx)){
    // if(reg.exec(ctx) == null){
    //     document.getElementById("ts").innerText="格式不正确";
    //     document.getElementById("ts").style.color="red";
    // }else{
    //     console.log(reg.exec(ctx));
    //     document.getElementById("ts").innerText="格式正确";
    //     document.getElementById("ts").style.color="green";
    // }
}